package it.zqdszb.library.ui;

import android.os.Bundle;

import it.zqdszb.library.basemvp.BaseModel;
import it.zqdszb.library.basemvp.BasePresenter;
import it.zqdszb.library.basemvp.BaseView;
import it.zqdszb.library.utils.ParameterizedTypeUtil;


/**
 * Created by wcy on 2018/1/18.
 */

public abstract class BaseMVPFragment<P extends BasePresenter, M extends BaseModel> extends BaseFragment implements BaseView {
    protected P presenter;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        presenter = ParameterizedTypeUtil.init(this, this, getThisActivity());
    }

    @Override
    protected void notLazyInitView() {
        super.notLazyInitView();
        this.initView();
    }

    protected  abstract void initView();

    @Override
    public void onDestroy() {
        if (presenter != null) presenter.onDettach();
        super.onDestroy();
    }
}
